How to Define a Count Metric (Alert)

One particular type of aggregation is the "COUNT" aggregation. Applications use this commonly to:

The count of tasks is particularly useful for defining "alert" metrics, since it is this count that the metric definition compares against the target thresholds. for instance, any Work Requests that are past due should raise a yellow warning; a large number of requests past due should raise a red or critical warning.

When defining a metric that represents a count of all records in a Collect Table, avoid writing in the "Collect:Formula" an asterisk, as in COUNT(*).Instead define the metric as in the example already in the help, where in the "Collect: Formula" you specify the field that for which you are counting (ex. "field:em_id").

You define metrics by loading the Define Metrics form:

Path: System / Add-In Manager / Define Metrics
URL: http://localhost:8080/archibus/ab-metric-metrics-def.axvw

Example

For example, the metric definition below counts the number of occupants. It takes this snapshot of the inventory data monthly.

Field Value
Metric Title Occupants
Metric Name occ_Occupants_monthly
Metric Description Total number of personnel housed in the facilities. This figure includes full-time personnel, contractors, and the fractional time of hotelled workers.
Business Implication This figure corresponds to the GSA "Employees Housed" figure. It gives a sense of the overall scope of the real-estate responsibility for personnel-driven lines of business. Decrease in the total number of employees, can be the consequence of business reorganization or higher efficiency rate, but can lead to under-utilization of some buildings.
Assumptions Use the Space Transactions feature of the Space Inventory & Performance application.
Collect: Recurrence Every Month, on the 1st Day of the Month
Collect: From Table em
Collect: Formula field:em_id
Collect: Where Clause bl_id IS NOT NULL
AND fl_id IS NOT NULL
AND rm_id IS NOT NULL
Report: Aggregate As COUNT
Report: Trend Direction No Significance
Numeric Format Number
Decimal Places 0 Places
Metric Granularity Assignments All, by Building

Comments

Report: Aggregate As. The "COUNT" aggregation operator instructs the metrics rule to count the records in the collection set (as opposed to "SUM", "AVERAGE", etc.)

Collect: Where Clause. This parameter instructs the metrics rule to filter the records in the collection set to just those that have Building, Floor, and Room Code assignments.

Collect: Formula. This parameter instructs the metrics rule to use the Employee Code field (em_id). For count metrics, the Collect Field is arbitrary as long is it is a field in the table you are collecting.

SQL. The parameters above would have the metrics rule form a query equivalent to:

SELECT COUNT(em_id) FROM em GROUP BY bl_id ORDER BY bl_id WHERE bl_id IS NOT NULL AND fl_id IS NOT NULL AND rm_id IS NOT NULL